package com.mdd.common.mapper.coupon;

import com.mdd.common.core.basics.IBaseMapper;
import com.mdd.common.entity.code.CouponCode;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Update;

/**
 * 优惠券兑换码Mapper
 */
@Mapper
public interface CouponCodeMapper extends IBaseMapper<CouponCode> {

	@Update("UPDATE la_coupon_code SET share_user = #{shareUser}  WHERE id IN(SELECT id FROM (SELECT id  FROM la_coupon_code where coupon_id = #{couponId} LIMIT #{pageNo} ,#{pageSize} ) AS tmp);")
	int updateByCouponId(@Param("couponId") Integer couponId,
	                     @Param("shareUser") Integer shareUser,
	                     @Param("pageNo") Integer pageNo,
	                     @Param("pageSize") Integer pageSize);
}
